<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>

<body>

    <!-- 
        组件注册:
        Vue.component(组件名称,{
            data:组件数组,
            template : 组件模板内容
        })
    -->
    <div id="app">
        <div><button-counter></button-counter></div>
        <div><button-counter></button-counter></div>
        <div><button-counter></button-counter></div>
    </div>

    <script>
        Vue.component('button-counter', {
            data: function () {
                return {
                    count: 0
                }
            },
            // template: '<button @click="count++">点击了{{count}}次</button>',
            template: '<button @click="handle">点击了{{count}}次</button>',
            methods: {
                handle: function () {
                    this.count += 2;
                }
            }
        })
        var vm = new Vue({
            el: "#app",
            data: {

            }
        })


    </script>


</body>

</html>